import 'package:json_annotation/json_annotation.dart';

// 这里的名称，必须和当前文件名称一致，例如：当前叫 user ，这里也是 user，
// user.dart 对应 user.g.dart
part 'user.g.dart';

/// 登录请求
@JsonSerializable()
class UserLoginRequestEntity {
  final String email;
  final String password;

  UserLoginRequestEntity({required this.email, required this.password});

  factory UserLoginRequestEntity.fromJson(Map<String, dynamic> json) =>
      _$UserLoginRequestEntityFromJson(json);

  Map<String, dynamic> toJson() => _$UserLoginRequestEntityToJson(this);
}

/// 登录返回
@JsonSerializable()
class UserLoginResponseEntity {
  @JsonKey(name: "access_token")
  final String accessToken;
  @JsonKey(name: "display_name")
  final String displayName;
  @JsonKey(name: "channels")
  final List<String> channels;

  UserLoginResponseEntity(
      {required this.accessToken,
      required this.displayName,
      required this.channels});

  factory UserLoginResponseEntity.fromJson(Map<String, dynamic> json) =>
      _$UserLoginResponseEntityFromJson(json);

  Map<String, dynamic> toJson() => _$UserLoginResponseEntityToJson(this);
}
